#include<bits/stdc++.h>

using namespace std;
const int maxn = 1e6 + 10;
int val[maxn], nxt[maxn], size = 0;//模拟链表
int main() {
    for (int i = 0; i < 10; i++) {
        val[size] = i;
        nxt[size] = -1;
        ++size;
    }
    for (int i = 0; i + 1 < size; i++) {
        nxt[i] = val[i + 1];
    }
    int head = 0;
    while (head!= -1) {
        cout << val[head] << endl;
        head = nxt[head];
    }
    return 0;
}